import request from "./request.js";

//登录
export function login(data) {
  return request({
    method: "post",
    url: "/login",
    data
  });
}

//获取用户信息
export function getInfo(token) {
  return request({
    method: "get",
    url: "user/info",
    params: { token }
  });
}

//退出
export function logout() {
  return request({
    method: "post",
    url: "user/logout"
  });
}

//贷款申请
export function createLoan(data) {
  return request({
    method: "post",
    url: "loan/create",
    data
  });
}

//申请管理 - 查询
export function loanList(data) {
  return request({
    method: "get",
    url: "loan/list",
    params: data
  });
}

//申请管理 - 提交
export function submitToApprove(data) {
  return request({
    method: "post",
    url: "loan/submitToApprove",
    data
  });
}

//申请管理 - 删除
export function loanDelete(data) {
  return request({
    method: "delete",
    url: "loan/delete/" + data.id,
    data
  });
}

//申请管理 - 编辑
export function loanUpdate(data) {
  return request({
    method: "put",
    url: "loan/update",
    data
  });
}

//贷款审批 -初审-查询
export function firstList(data) {
  return request({
    method: "get",
    url: "approve/first/list",
    params: data
  });
}

//贷款审批 -初审-查看详情
export function firstQuery(data) {
  return request({
    method: "get",
    url: "loan/query",
    params: data
  });
}

//贷款审批 -初审-通过
export function firstPass(data) {
  return request({
    method: "post",
    url: "approve/first/pass",
    data
  });
}

//贷款审批 -初审-拒绝
export function firstReject(data) {
  return request({
    method: "post",
    url: "approve/first/reject",
    data
  });
}

//贷款审批 -终审-查询
export function endList(data) {
  return request({
    method: "get",
    url: "approve/end/list",
    params: data
  });
}

//贷款审批 -终审-查看详情
export function endQuery(data) {
  return request({
    method: "get",
    url: "loan/query",
    params: data
  });
}

//贷款审批 -终审-通过
export function endPass(data) {
  return request({
    method: "post",
    url: "approve/end/pass",
    data
  });
}

//贷款审批 -终审-拒绝
export function endReject(data) {
  return request({
    method: "post",
    url: "approve/end/reject",
    data
  });
}

//标的管理-获取数据
export function contractLists(data) {
  return request({
    method: "get",
    url: "contract/list",
    params: data
  });
}

//标的管理-生成合同
export function contractCreateFile(data) {
  return request({
    method: "post",
    url: "contract/createFile",
    data
  });
}

//标的管理-下载合同
export function contractDownload(data) {
  return request({
    method: "get",
    url: "contract/download",
    params: data
  });
}

//权限管理-创建管理员
export function permissionCreateUser(data) {
  return request({
    url: "permission/createUser",
    method: "post",
    data
  });
}

//权限管理-列表展示
export function userList(data) {
  return request({
    method: "get",
    url: "user/list",
    params: data
  });
}
